<html>
<head><meta charset="utf-8"><title>Who to talk to about improving `resolve_instances` · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Who.20to.20talk.20to.20about.20improving.20.60resolve_instances.60.html">Who to talk to about improving `resolve_instances`</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="247215241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Who%20to%20talk%20to%20about%20improving%20%60resolve_instances%60/near/247215241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Xavier Denis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Who.20to.20talk.20to.20about.20improving.20.60resolve_instances.60.html#247215241">(Jul 26 2021 at 15:05)</a>:</h4>
<p>I've discovered the terrifically useful function <code>resolve_instance</code> which i'd like to use in my rustc plugin, but it has one minor issue: when the instance doesn't exist a threatening error is printed to stderr. This occurs because <code>resolve_instance</code> transitively calls <code>codegen_fulfill_obligation</code> which assumes it runs after type checking and that all instances will thus be found. </p>
<p>I'd like to make it so <code>resolve_instance</code> doesn't print this error but instead returns a message in the error branch of the <code>Result</code>, but I'm not sure what the best approach is (I'm not familiar with this area of the compiler)</p>



<a name="247215444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Who%20to%20talk%20to%20about%20improving%20%60resolve_instances%60/near/247215444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Xavier Denis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Who.20to.20talk.20to.20about.20improving.20.60resolve_instances.60.html#247215444">(Jul 26 2021 at 15:07)</a>:</h4>
<p>I figured i would find the most informed people here, I'm happy to make any required changes but I'd love a little guidance on what would be the most idiomatic manner</p>



<a name="247215499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Who%20to%20talk%20to%20about%20improving%20%60resolve_instances%60/near/247215499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Xavier Denis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Who.20to.20talk.20to.20about.20improving.20.60resolve_instances.60.html#247215499">(Jul 26 2021 at 15:07)</a>:</h4>
<p>(ie: should I just replace <code>codegen_fulfill_obligation</code> with a version that doesn't print to stderr?)</p>



<a name="247215785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Who%20to%20talk%20to%20about%20improving%20%60resolve_instances%60/near/247215785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Who.20to.20talk.20to.20about.20improving.20.60resolve_instances.60.html#247215785">(Jul 26 2021 at 15:09)</a>:</h4>
<p>what <code>ParamEnv</code> are you using?</p>



<a name="247215917"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Who%20to%20talk%20to%20about%20improving%20%60resolve_instances%60/near/247215917" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Who.20to.20talk.20to.20about.20improving.20.60resolve_instances.60.html#247215917">(Jul 26 2021 at 15:10)</a>:</h4>
<p>Some things are less/more aggressive depending on the reveal mode of the param env</p>



<a name="247219747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Who%20to%20talk%20to%20about%20improving%20%60resolve_instances%60/near/247219747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Xavier Denis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Who.20to.20talk.20to.20about.20improving.20.60resolve_instances.60.html#247219747">(Jul 26 2021 at 15:37)</a>:</h4>
<p>I was using <code>txt.param_env</code> so I assume it’s <code>UserFacing</code></p>



<a name="247219844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Who%20to%20talk%20to%20about%20improving%20%60resolve_instances%60/near/247219844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Xavier Denis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Who.20to.20talk.20to.20about.20improving.20.60resolve_instances.60.html#247219844">(Jul 26 2021 at 15:37)</a>:</h4>
<p>I don’t have the code in front of me right now but I think that the error in <code>codegen_fulfill_obligation</code> isn’t conditional</p>



<a name="247224527"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Who%20to%20talk%20to%20about%20improving%20%60resolve_instances%60/near/247224527" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Who.20to.20talk.20to.20about.20improving.20.60resolve_instances.60.html#247224527">(Jul 26 2021 at 16:11)</a>:</h4>
<p>right... if it knows this is a failure for sure, it will still always error</p>



<a name="247225903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Who%20to%20talk%20to%20about%20improving%20%60resolve_instances%60/near/247225903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Xavier Denis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Who.20to.20talk.20to.20about.20improving.20.60resolve_instances.60.html#247225903">(Jul 26 2021 at 16:22)</a>:</h4>
<p>It is a failure in the context of codegen, but I’d like to use it outside that context</p>



<a name="247225975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Who%20to%20talk%20to%20about%20improving%20%60resolve_instances%60/near/247225975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Xavier Denis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Who.20to.20talk.20to.20about.20improving.20.60resolve_instances.60.html#247225975">(Jul 26 2021 at 16:22)</a>:</h4>
<p>In particular <code>resolve_instance</code> does a lot of work turning the result of instance selection into an <code>Instance</code></p>



<a name="247226700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Who%20to%20talk%20to%20about%20improving%20%60resolve_instances%60/near/247226700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Who.20to.20talk.20to.20about.20improving.20.60resolve_instances.60.html#247226700">(Jul 26 2021 at 16:28)</a>:</h4>
<p>I guess write an MCP to make it fallible?</p>



<a name="247226776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Who%20to%20talk%20to%20about%20improving%20%60resolve_instances%60/near/247226776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Who.20to.20talk.20to.20about.20improving.20.60resolve_instances.60.html#247226776">(Jul 26 2021 at 16:29)</a>:</h4>
<p>I don't see any strong reason against it, but it's an important piece of the compiler. we should at least inform everyone ahead of time that it's being changed in ways the compiler doesn't need, but that are great for driver users</p>



<a name="247228012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Who%20to%20talk%20to%20about%20improving%20%60resolve_instances%60/near/247228012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Who.20to.20talk.20to.20about.20improving.20.60resolve_instances.60.html#247228012">(Jul 26 2021 at 16:39)</a>:</h4>
<p>This might help rustdoc as well</p>



<a name="247255996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Who%20to%20talk%20to%20about%20improving%20%60resolve_instances%60/near/247255996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Xavier Denis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Who.20to.20talk.20to.20about.20improving.20.60resolve_instances.60.html#247255996">(Jul 26 2021 at 20:17)</a>:</h4>
<p>Alright I'll write an MCP then</p>



<a name="248609515"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Who%20to%20talk%20to%20about%20improving%20%60resolve_instances%60/near/248609515" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Xavier Denis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Who.20to.20talk.20to.20about.20improving.20.60resolve_instances.60.html#248609515">(Aug 06 2021 at 13:21)</a>:</h4>
<p><a href="https://github.com/rust-lang/compiler-team/issues/449">https://github.com/rust-lang/compiler-team/issues/449</a> I filed an MCP two weeks ago for this issue and I've successfully implemented a version of this which works for my extension usecase</p>



<a name="248609560"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Who%20to%20talk%20to%20about%20improving%20%60resolve_instances%60/near/248609560" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Xavier Denis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Who.20to.20talk.20to.20about.20improving.20.60resolve_instances.60.html#248609560">(Aug 06 2021 at 13:21)</a>:</h4>
<p>I'd be curious for feedback on this MCP</p>



<a name="248617802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Who%20to%20talk%20to%20about%20improving%20%60resolve_instances%60/near/248617802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Who.20to.20talk.20to.20about.20improving.20.60resolve_instances.60.html#248617802">(Aug 06 2021 at 14:27)</a>:</h4>
<p>There's a thread dedicated for it: <a href="#narrow/stream/233931-xxx/topic/Make.20.60resolve_instance.60.20fallible.20compiler-team.23449">https://rust-lang.zulipchat.com/#narrow/stream/233931-xxx/topic/Make.20.60resolve_instance.60.20fallible.20compiler-team.23449</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>